<template>
  <div>
    <h1>菜单管理页面</h1>
    <button id="counter" @click="increment">{{ count }}</button>
  </div>
</template>

<script setup lang="ts">
import { ref, nextTick } from 'vue'

const count = ref(0)

async function increment() {
  count.value++

  // DOM 还未更新
  console.log(document.getElementById('counter').textContent) // 0

  await nextTick()
  // DOM 此时已经更新
  console.log(document.getElementById('counter').textContent) // 1
}
</script>

<style scoped></style>
